#ifndef __BSP_AHT21_Driver_H
#define __BSP_AHT21_Driver_H


//******************************** Includes *********************************//
#include <stdio.h>                    
#include <stdint.h>

//******************************** Includes *********************************//

typedef struct 
{
    /* function pointers */
    int8_t (*pfinit                   ) (void);
    int8_t (*pfdeinit                 ) (void);
    int8_t (*pfwrite_bytes            ) (uint8_t *pdata,
                                         uint32_t size);
    int8_t (*pfread_bytes             ) (uint8_t *pdata, 
                                         uint32_t size);
    int8_t (*pfwrite_register_bytes   ) (uint8_t addr,  
                                         uint8_t *pdata,
                                         uint32_t size);
    int8_t (*pfread_register_bytes    ) (uint8_t addr,
                                         uint8_t *pdata, 
                                         uint32_t size);
}iic_driver_interface_t;

typedef struct 
{
    /* function pointers */
    int8_t (*pfdelay_ms         ) (uint32_t  ms);
    int8_t (*pfdelay_us         ) (uint32_t  us);
}system_interface_t;

typedef struct 
{
    /* function pointers */
    uint32_t (*pfget_tick_count) (void);                        
} timebase_interface_t;


typedef struct bsp_aht21_driver_t 
{
    /* variable */
    iic_driver_interface_t*         psiic_driver_interface; 
    timebase_interface_t*             pstimebase_interface;
    system_interface_t*                  psystem_interface;
    
    /* function pointers */
    int8_t (*pfinst              ) (struct bsp_aht21_driver_t* instance);
    int8_t (*pfdeinst            ) (struct bsp_aht21_driver_t* instance);
    int8_t (*pfinit              ) (struct bsp_aht21_driver_t* instance);
    int8_t (*pfdeinit            ) (struct bsp_aht21_driver_t* instance);
    int8_t (*pfread_id           ) (struct bsp_aht21_driver_t* instance,
									uint8_t *id);
    int8_t (*pfread_data         ) (struct bsp_aht21_driver_t* instance, 
								  float* ptemperature,
                                    float* phumidity);
}bsp_aht21_driver_t;

int8_t aht21_inst(bsp_aht21_driver_t* aht21_instance,
                 iic_driver_interface_t* iic_instance,
                 timebase_interface_t* timebase_instance
                 );
#endif //_BSP_AHT21_DRIVER_H_


